#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //启动线程
    t.start();
    //绑定子线程自定义信号信号槽
    connect(&t,&MyThread::timeout,this,&Widget::handleTime);
}

Widget::~Widget()
{
    delete ui;
}

//倒计时操作
void Widget::handleTime()
{
     int value = ui->lcdNumber->value();
     value--;
     ui->lcdNumber->display(value);
}

